using System;
using System.Windows.Forms;

namespace uk.org.aspellclark.todolistppc
{
    /// <summary>
    ///   <name>TodoListTreeNode</name>
    ///   <namespace>uk.org.aspellclark.todolistppc</namespace>
    ///   <version>1.0</version>
    ///   <author>Andy Aspell-Clark</author>
    ///   <description>
    ///   </description>
    ///   <history>
    ///     <historyitem> 1 Aug 2004  1.0 ARA  Initial Version.</historyitem>
    ///   </history>
    /// </summary>
	public class TodoListTreeNode: TreeNode
    {
        private int   m_iTaskId = -1;
        private int   m_iParentTaskId = -1;
        private CTask m_Task = null;

        /// <summary>
        /// 
        /// </summary>
        public CTask Task
        {
            get { return m_Task;  }
            set { m_Task = value; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int TaskId
        {
            get { return m_iTaskId;  }
            set { m_iTaskId = value; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int ParentTaskId
        {
            get { return m_iParentTaskId;  }
            set { m_iParentTaskId = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="psString"></param>
		public TodoListTreeNode(string psString)
            :base(psString)
		{
		}


        /// <summary>
        /// 
        /// </summary>
        public void Clicked(bool pbChecked)
        {
            Task.Complete = pbChecked;
            if (Task.Complete)
            {
                Task.PercentComplete = 100;
            }
            else
            {
                Task.PercentComplete = 0;
            }
        }
	}
}
